package org.xjc.service;


import org.springframework.stereotype.Service;
import org.xjc.entity.ErrorLog;
import org.xjc.mapper.ErrorLogMapper;
import org.xjc.utils.IdGenerator;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @Author : XJC
 * @Description :错误保存服务
 * @create : 2022/8/3 14:19
 */
@Service
public class ErrorLogServiceImpl implements ErrorLogService {

    @Resource
    private ErrorLogMapper errorLogMapper;

    @Override
    public void saveErrorLog(String description, String method, String params, Date operationTime, String throwable, String nameCreate) {
        ErrorLog errorLog = new ErrorLog();
        errorLog.setId(IdGenerator.nextId());
        errorLog.setDescription(description);
        errorLog.setMethod(method);
        errorLog.setParams(params);
        errorLog.setThrowable(throwable);
        errorLog.setGmtCreate(new Date());
        errorLog.setNameCreate(nameCreate);
        errorLogMapper.insert(errorLog);
    }



}
